package battlefield;

import io.ClientSession;
import io.OperationResponse;

import java.util.HashMap;

import player.Player;
import protocol.OpCode;
import protocol.ReturnCode;

public class BattleFieldPublic {
	
	 public void SendBattlefiledInfo(HashMap<Short, Object> parms,ClientSession session)
     {
		 if(session == null)
    	 {
    		 return;
    	 }
         Player.log.debug("============================================SendBattlefiledInfo =============================================");
         OperationResponse response = new OperationResponse(OpCode.BattlefieldInfo, parms,ReturnCode.Yes,"");
         session.SendOperationResponse(response);
     }
	 
	 public void SendBattlefiledInfoBoss(HashMap<Short, Object> parms,ClientSession session)
     {
		 if(session == null)
    	 {
    		 return;
    	 }
         Player.log.debug("============================================SendBattlefiledInfoBoss =============================================");
         OperationResponse response = new OperationResponse(OpCode.BattlefieldInfoBoss, parms,ReturnCode.Yes,"");
         session.SendOperationResponse(response);
     }
	 
     public void SendSpawnInfo(HashMap<Short, Object> parms,ClientSession session)
     {
    	 if(session == null)
    	 {
    		 return;
    	 }
         OperationResponse response = new OperationResponse(OpCode.BattlefieldSpawnInfo, parms,ReturnCode.Yes,"");
         session.SendOperationResponse(response);
     }
     
     public void SendBattlefieldReady(ClientSession session)
     {
    	 if(session == null)
    	 {
    		 return;
    	 }
         Player.log.info("============================================SendBattlefieldReady =============================================");
         OperationResponse response = new OperationResponse(OpCode.BattlefieldReady,null,ReturnCode.Yes,"");
         session.SendOperationResponse(response);
     }
     
     public void SendScoreInfo(HashMap<Short,Object> parms,ClientSession session)
     {
    	 if(session == null)
    	 {
    		 return;
    	 }
         OperationResponse response = new OperationResponse(OpCode.BattlefieldScoreInfo, parms,ReturnCode.Yes,"");
         session.SendOperationResponse(response);
     }
     
     public void SendBattlefieldBossInfo(HashMap<Short,Object> parms,ClientSession session)
     {
    	 if(session == null)
    	 {
    		 return;
    	 }
         OperationResponse response = new OperationResponse(OpCode.BattlefieldBossInfo, parms,ReturnCode.Yes,"");
         session.SendOperationResponse(response);
     }
     
     public void SendBattlefiledResult(HashMap<Short,Object> parms,ClientSession session)
     {
    	 if(session == null)
    	 {
    		 return;
    	 }
         Player.log.debug("============================================SendBattlefiledResult =============================================");
         OperationResponse response = new OperationResponse(OpCode.BattlefieldResult, parms,ReturnCode.Yes,"");
         session.SendOperationResponse(response);
     }

     public void SendBattlefiledResultBoss(HashMap<Short,Object> parms,ClientSession session)
     {
    	 if(session == null)
    	 {
    		 return;
    	 }
    	 Player.log.debug("============================================SendBattlefiledResultBoss =============================================");
         OperationResponse response = new OperationResponse(OpCode.BattlefieldResultBoss, parms,ReturnCode.Yes,"");
         session.SendOperationResponse(response);
     }
     
     public void SendBattlefiledExit(HashMap<Short,Object> parms,ClientSession session)
     {
    	 if(session == null)
    	 {
    		 return;
    	 }
    	 Player.log.info("============================================SendBattlefiledExit =============================================\n" );
         OperationResponse response = new OperationResponse(OpCode.BattlefieldNotifyExit, parms,ReturnCode.Yes,"");
         session.SendOperationResponse(response);
     }
     
     public void SendBattlefiledTimeOut(ClientSession session,HashMap<Short, Object> paras)
     {
    	 if(session == null)
    	 {
    		 return;
    	 }
    	 Player.log.info("============================================SendBattlefiledTimeOut =============================================\n" );
         OperationResponse response = new OperationResponse(OpCode.BattlefieldTimeOut, paras,ReturnCode.Yes,"");
         session.SendOperationResponse(response);
     }
     public void SendCancelBattlefield(ClientSession session)
     {
    	 if(session == null)
    	 {
    		 return;
    	 }
    	 Player.log.info("============================================SendBattlefiledCancel =============================================\n" );
         OperationResponse response = new OperationResponse(OpCode.PVPCancel, null,ReturnCode.Yes,"");
         session.SendOperationResponse(response);
     }
}
